package com.bruce.httpclient;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author Bruce
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class User {
    private String name;
    private String password;
    private Date birth;

    public int getAge(){
        if (birth == null){
            return -1;
        }
        return new Date().getYear() - birth.getYear();
    }

    public void setAge(int age){}

    @Override
    public String toString() {
        return "{\"name\":\""+name+"\", \"password\":\""+password+"\"}";
    }
}
